package com.yan.demo;

import java.util.concurrent.*;

/**
 * @author taoge
 * @Date 2024/8/12 10:43
 * @Description
 */
public class ThreadPoolCallable {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable callable = new Callable() {
            @Override
            public Object call() throws Exception {

                return 2.5;
            }
        };

        ExecutorService threadPool = Executors.newSingleThreadExecutor();
        Future submit = threadPool.submit(callable);
        System.out.println(submit.get());
    }
}
